<?php
/* --------------------------------------------------------------
   testeo.php 2011-11-07 gm
   Gambio GmbH
   http://www.gambio.de
   Copyright (c) 2011 Gambio GmbH
   Released under the GNU General Public License
   --------------------------------------------------------------
*/
?><?php

class Testeo
{
	var $v_partnerlink;
	var $v_export_type;
	var $v_module_name;
	var $v_module_homepage;
	var $v_module_format;
	var $v_module_export_filename;
	var $v_filename;
	var $v_keyname;
	var $v_linkname;
	var $v_delimiter;
	var	$v_enclosure;

	var $v_field_filename;
	var $v_field_customers_groups;
	var $v_field_currency;
	var $v_field_shipping_costs;
	var $v_field_shipping_costs_free;
	var $v_field_attributes;
	var $v_field_campaign;
	var $v_field_export;

	var $v_category_file_path;
	var	$v_shipping_availability_array = array();
	var	$v_availability_array = array();

	function Testeo()
	{
		$this->formSettings();
	}

	function formSettings()
	{
		$this->v_partnerlink='';
		$this->v_export_type='comparison';
		$this->v_module_name='Testeo.de';
		$this->v_module_homepage='www.testeo.de';
		$this->v_module_format='csv';
		$this->v_module_export_filename='testeo.csv';
		$this->v_filename='testeo.php';
		$this->v_keyname='TESTEO';
		$this->v_linkname='testeo';
		$this->v_delimiter="|";
		$this->v_enclosure='';

		$this->v_field_filename=true;
		$this->v_field_customers_groups=true;
		$this->v_field_currency=true;
		$this->v_field_shipping_costs=false;
		$this->v_field_shipping_costs_free=false;
		$this->v_field_attributes=true;
		$this->v_field_campaign=true;
		$this->v_field_export=true;
	}

	function formAddOn()
	{
		return '';
	}

	function formatResults($p_products_array)
	{
		$p_products_array['products_name'] = trim(str_replace("|", ',', no_html($p_products_array['products_name'])));
		$p_products_array['products_description'] = trim(str_replace("|", ',', no_html($p_products_array['products_description'])));
		
		if(strlen($p_products_array['products_description']) > 253)
		{
			$p_products_array['products_description'] = substr($p_products_array['products_description'], 0, 253);
		}

		$p_products_array['products_short_description'] = trim(str_replace("|", ',', no_html($p_products_array['products_short_description'])));

		if(strlen($p_products_array['products_short_description']) > 253)
		{
			$p_products_array['products_description'] = substr($p_products_array['products_short_description'], 0, 253);
		}

		$p_products_array['products_price'] = number_format((double)$p_products_array['products_price'], 2, '.', '');

		$p_products_array['products_weight'] = (double)$p_products_array['products_weight'];

		return($p_products_array);
	}

	function exportScheme()
	{
		$t_csv_fields_array=array();
		$t_csv_fields_array['products_id']= 'ProduktID';
		$t_csv_fields_array['products_weight']= 'Gewicht';
		$t_csv_fields_array['products_ean']= 'EAN';
		$t_csv_fields_array['manufacturers_name']= 'Hersteller';
		$t_csv_fields_array['products_name'] = 'ProduktBezeichnung';
		$t_csv_fields_array['products_model']= 'ArtikelNroderHerstellerArtikelNr';
		$t_csv_fields_array['products_price'] = 'Preis';
		$t_csv_fields_array['products_description'] = 'ProduktLangBeschreibung';
		$t_csv_fields_array['products_short_description'] = 'ProduktKurzBeschreibung';
		$t_csv_fields_array['products_shippingtime']= 'Lieferzeit';
		$t_csv_fields_array['products_link'] = 'Produktlink';
		$t_csv_fields_array['products_image_1'] = 'FotoLink';
		$t_csv_fields_array['products_categories'] = 'Kategoriename';		

		return($t_csv_fields_array);
	}
}
?>